package com.shareach.basic;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;

import com.google.common.util.concurrent.ListeningScheduledExecutorService;
import com.google.common.util.concurrent.MoreExecutors;

public class AsyncExecutor {
	private static ExecutorService executor = Executors.newFixedThreadPool(500);
	private static ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(50);

	public static ExecutorService getExecutor() {
		return executor;
	}
	
	public static ScheduledExecutorService getScheduledExecutorService() {
		return MoreExecutors.getExitingScheduledExecutorService(scheduledThreadPoolExecutor);
	}
	
	public static ListeningScheduledExecutorService getListeningScheduledExecutorService() {
		return MoreExecutors.listeningDecorator(getScheduledExecutorService());
	}
	
}
